/***************
 * Project Submissions Panel
 */
AIR2.Project.Submissions = function() {
    return new AIR2.UI.Panel({
        showAllLink: AIR2.Project.SUBMSRCH,
        storeData: AIR2.Project.SUBMDATA,
        url: AIR2.Project.BASEURL + '/submissions',
        colspan: 2,
        title: 'Recent Submissions',
        showTotal: true,
        iconCls: 'air2-project-submissions-icon',
        itemSelector: '.air2-project-submission-row',
        tpl: new Ext.XTemplate(
            '<table>' +
              '<tpl for="."><tr class="air2-project-submission-row">' +
                '<td>' +
                  '{[AIR2.Format.inquiryTitle(values.Inquiry, true)]}<br/>' +
                  '{[this.formatContent(values)]}' +
                '</td>' +
                '<td class="air2-project-subm-info"><div class="air2-dragzone"' +
                  ' air2uuid="{values.Source.src_uuid}" air2type="S">' +
                  '<span>{[AIR2.Format.sourceName(values.Source, true)]}</span><br/>' +
                  '<span>{[AIR2.Format.date(values.srs_date)]}</span>' +
                '</div></td>' +
              '</tr></tpl>' +
            '</table>',
            {
                compiled: true,
                disableFormats: true,
                formatContent: function(values) {
                    var rsp = values.SrcResponse[0];
                    var noTags = Ext.util.Format.stripTags(rsp.sr_orig_value);
                    var link = AIR2.Format.submissionMore(values);
                    return Ext.util.Format.ellipsis(noTags, 180, true)+' '+link;
                }
            }
        )
    });
}
